import * as types from '../action-types'
let initial = {
    list: null
}
export default (state = initial, action) => {
    state = { ...state }
    switch (action.type) {
        case types.STORE_LIST:
            state.list = action.list
            break;
        case types.STORE_REMOVE:
            if(Array.isArray(state.list)){
                state.list = state.list.filter(item=>{
                    return +action.id !== item.id
                })
            }
            break;
        default:
    }

    return state
}